//
//  WDWorderOrderWaitVehicleDetailServiceView.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2025/4/13.
//

#import "WDWorderOrderWaitVehicleDetailServiceView.h"
#import "WDArrivalServiceDetailModel.h"

@interface WDWorderOrderWaitVehicleDetailServiceView ()
@property (nonatomic, strong) WDArrivalServiceDetailModel *taskDetailModel;

/// 创建时间
@property (nonatomic, strong) WDTaskDetailBasicSingleView *createTimeView;

/// 预约时间
@property (nonatomic, strong) WDTaskDetailBasicSingleView *appointTimeView;

@end

@implementation WDWorderOrderWaitVehicleDetailServiceView


- (void)initWithSubView {
    [super initWithSubView];
    
    self.backgroundColor = [UIColor whiteColor];
    
}

/// 创建时间
- (void)initWithCreateTimeView {
    if (!_createTimeView) {
        CGRect frame = CGRectMake(0, 0, self.width, kWDTaskDetailBasicSingleViewHeight);
        _createTimeView = [[WDTaskDetailBasicSingleView alloc] initWithFrame:frame];
        [self addSubview:_createTimeView];
    }
    if (self.taskDetailModel) {
        NSString *str = objectNull(self.taskDetailModel.createTime);
        if ([str isEqualToString:@""]) {
            str = @"--";
        }
        [_createTimeView updateWithViewTitle:@"创建时间" value:str valueHeight:18];
    }
}

/// 预约时间
- (void)initWithAppointTimeView {
    if (!_appointTimeView) {
        CGRect frame = self.createTimeView.frame;
        frame.origin.y = self.createTimeView.bottom;
        _appointTimeView = [[WDTaskDetailBasicSingleView alloc] initWithFrame:frame];
        [self addSubview:_appointTimeView];
    }
    if (self.taskDetailModel) {
        NSString *str = objectNull(self.taskDetailModel.appointmentTime);
        if ([str isEqualToString:@""]) {
            str = @"--";
        }
        [_appointTimeView updateWithViewTitle:@"预约时间" value:str valueHeight:18];
    }
}

- (void)updateWithViewData:(id)data {
    self.taskDetailModel = data;
    
    /// 创建时间
    [self initWithCreateTimeView];
    
    /// 预约时间
    [self initWithAppointTimeView];

}

@end
